package com.huawei.appgallery.push.api.receiver;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.huawei.secure.android.common.intent.SafeBroadcastReceiver;
import com.huawei.secure.android.common.intent.SafeIntent;
import java.util.LinkedHashMap;
import o.ccz;
import o.cfw;
import o.ctx;
import o.cuk;
import o.dgh;
import o.dgo;
import o.dgr;
import o.dgt;
import o.diu;
import o.dkn;
import o.Logger;
import o.dok;

public class PushDealReceiver extends SafeBroadcastReceiver {
    public static final String PUSH_DISPATCH_BUNDLE_KEY = "pushDispatchBundleKey";
    public static final String PUSH_MSG_BEAN = "pushMsgBeanObj";

    public void onReceiveMsg(Context context, Intent intent) {
        if (intent.getExtras() == null) {
            Logger.e("PushDealReceiver", "onReceive(), bundle is null");
            return;
        }
        String action = intent.getAction();
        boolean ˎ = diu.ˊ().ˎ();
        Logger.ˎ("PushDealReceiver", "onReceive() action=" + action + " , hasAgreedPotocal is " + ˎ);
        if (!ˎ) {
            Logger.e("PushDealReceiver", "onReceive(), hasAgreedPotocal is false");
        } else if ("android.huawei.appmarket.pushdeal.dispatchnew".equals(action)) {
            ˋ(context, new SafeIntent(intent));
            if (dgr.ˋ().ॱ("push")) {
                LinkedHashMap linkedHashMap = new LinkedHashMap(2);
                linkedHashMap.put("start_type", "push");
                linkedHashMap.put("service_type", Integer.valueOf(ccz.ॱ()));
                dgh.ˋ("action_start_by_type", linkedHashMap);
                if (dok.ͺ()) {
                    cfw.ˎ(new dgt("push|" + ccz.ॱ()), new dgo("PushDealReceiver"));
                }
            }
        }
    }

    private void ˋ(Context context, SafeIntent safeIntent) {
        Bundle bundleExtra = safeIntent.getBundleExtra(PUSH_DISPATCH_BUNDLE_KEY);
        if (bundleExtra == null) {
            Logger.e("PushDealReceiver", "pushOnDispatcher, dispatchBundle is null");
            return;
        }
        cuk o_cuk = (cuk) bundleExtra.getSerializable(PUSH_MSG_BEAN);
        if (o_cuk == null) {
            Logger.e("PushDealReceiver", "pushOnDispatcher, msgBean is null");
            return;
        }
        Logger.ˎ("PushDealReceiver", "onReceive() msgBean id:" + o_cuk.ˋ());
        new ctx(context).ॱ(o_cuk);
        dkn o_dkn = (dkn) bundleExtra.getSerializable("anytic_args_key");
        if (o_dkn != null) {
            o_dkn.onEventNotifyClick(context);
        }
    }
}
